import React, { Component } from 'react'
import {sendAction} from '../../action'
import store from '../../store'

export default class Home extends Component {
    handleClick = () => {
        const action = sendAction();
        store.dispatch(action);
    }
    componentDidMount() {
        store.subscribe( () => {
            console.log('subscribe:', store.getState());
            this.setState({})
            
        })
    }
    render() {
        return (
            <div>
                <button onClick={this.handleClick}>点我点我，发送一个action</button>
                {store.getState().value}
            </div>
        )
    }
}
